import {Result, TableDataInfo} from "@/model";
import request from "@/utils/request";
import {AxiosPromise} from "axios";
import {Example, ExampleQuery} from "@/api/example/types";

/**
 * 查询实例列表
 * @param params 条件
 */
export function getExampleList(params: ExampleQuery): AxiosPromise<TableDataInfo> {
    return request({
        url: "/dome/example/list",
        method: "get",
        params,
    });
}

/**
 * 新增实例列表(更新cpu和内存时触发)
 * @param data 条件
 */
export function addExample(data: Example): AxiosPromise<Result<number>> {
    return request({
        url: "/dome/example/add",
        method: "post",
        data,
    });
}

/**
 * 更新实例
 */
export function updateExample(data: Example): AxiosPromise<Result<null>> {
    return request({
        url: "/dome/example/update",
        method: "put",
        data,
    });
}